CXX = g++
CFLAGS = -Wall
RM = rm -f
LIBS = -lpthread -lcryptopp

SRCS = server.cpp chatroom.cpp ../lib/message.cpp ../lib/jRsa.cpp ../lib/jAes.cpp ../lib/socket.cpp ../lib/serversocket.cpp 
OBJS = $(subst .cpp,.o,$(SRCS))

all: server

server: $(OBJS)
	${CXX} ${CFLAGS} $(OBJS) ${LIBS} -o server

server.o: server.cpp chatroom.h ../lib/message.h ../lib/serversocket.h ../lib/socket.h ../lib/unix_exceptions.h

chatroom.o: chatroom.cpp chatroom.h

../lib/message.o: ../lib/message.cpp ../lib/message.h

../lib/socket.o: ../lib/socket.cpp ../lib/socket.h

../lib/serversocket.o: ../lib/serversocket.cpp ../lib/serversocket.h

../lib/unix_exceptions.o: ../lib/unix_exceptions.h

../lib/jRsa.o: ../lib/jRsa.cpp ../lib/jRsa.h

../lib/jAes.o: ../lib/jAes.cpp ../lib/jAes.h

clean:
	$(RM) $(OBJS)
	$(RM) *~
	$(RM) ../lib/*~
